package com.springframework.autowire_t.service;

import com.springframework.autowire_t.dao.UserDao;

public class UserServiceImpl implements UserService {
    private UserDao userDao;

//    基于setter方法进行依赖注入
    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }

    @Override
    public void addUserService() {
        System.out.println("添加userService...");
        /*
        * 如果要调用UserDao中的方法
        * 需要: UserDao userDao = new UserDao();
        * userDao.addUser();
        * */
        userDao.addUser();
    }
}
